﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace LinkShareWpf.Converters
{   //SelectedIndexToBoolConverter implementa l'interfaccia IValueConverter che presenta i metodi Convert (dal Source al Target) e ConvertBack.
    public class SelectedIndexToBoolConverter : IValueConverter 
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int? val = (int?)value;
            if (val < 0 || val == null)
                return false;
            else
                return true;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
